﻿using MenuService.Entities;
using Microsoft.EntityFrameworkCore;
using Volo.Abp;
using Volo.Abp.EntityFrameworkCore.Modeling;

namespace MenuService.EntityFrameworkCore;

public static class MenuServiceDbContextModelCreatingExtensions
{
    public static void ConfigureMenuService(
        this ModelBuilder builder)
    {
        Check.NotNull(builder, nameof(builder));



        builder.Entity<AbpMenu>(b =>
        {
            b.ToTable("AbpMenus", MenuServiceDbProperties.DbSchema);

            b.ConfigureByConvention();

            b.HasIndex(x => new { x.Name, x.Code, x.Permission }).IsUnique();
        });

    }
}
